package org.eddycar.jproyeddycar.contrato.vistas;

import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.filechooser.FileNameExtensionFilter;
import org.eddycar.jproyeddycar.contrato.dao.DaoClase;
import org.eddycar.jproyeddycar.contrato.dao.DaoMarca;
import org.eddycar.jproyeddycar.contrato.dao.DaoModificacion;
import org.eddycar.jproyeddycar.contrato.dao.DaoTipo;
import org.eddycar.jproyeddycar.contrato.dao.DaoVehiculo;
import org.eddycar.jproyeddycar.contrato.modelo.Clase;
import org.eddycar.jproyeddycar.contrato.modelo.Marca;
import org.eddycar.jproyeddycar.contrato.modelo.Modificacion;
import org.eddycar.jproyeddycar.contrato.modelo.Tipo;
import org.eddycar.jproyeddycar.contrato.modelo.TipoModificacion;
import org.eddycar.jproyeddycar.contrato.modelo.Vehiculo;
import org.eddycar.jproyeddycar.contrato.negocio.AdministrarVehiculoUCC;
import org.jdesktop.observablecollections.ObservableList;

public class AdminVehiculo extends javax.swing.JDialog {

    DaoVehiculo dv = new DaoVehiculo();
    File f = new File("");
    DaoClase daoClase = new DaoClase();
    DaoTipo daoTipo = new DaoTipo();
    DaoMarca daoMarca = new DaoMarca();
    DaoModificacion dm = new DaoModificacion();
    Vehiculo v1;
    Modificacion modi;
    Marca marca = new Marca();
    Tipo tipo = new Tipo();
    Clase clase = new Clase();
    boolean edit = false;
    AdministrarVehiculoUCC vehiculoUCC = new AdministrarVehiculoUCC();

    public AdminVehiculo() {
        initComponents();
        setLocationRelativeTo(this);
        setAlwaysOnTop(true);
        cargarDatosCombos();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        vistaVehiculo = new javax.swing.JDialog();
        PanelNuevoVehiculo = new javax.swing.JPanel();
        tabbedPaneRound1 = new org.edisoncor.gui.tabbedPane.TabbedPaneRound();
        panelImage2 = new org.edisoncor.gui.panel.PanelImage();
        panelRound2 = new org.edisoncor.gui.panel.PanelRound();
        lblPlacaNuevo = new javax.swing.JLabel();
        txtPlacaNuevo = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        lblTelfCel2 = new javax.swing.JLabel();
        lblTelfCel = new javax.swing.JLabel();
        lblTelfCel1 = new javax.swing.JLabel();
        lblMotor2 = new javax.swing.JLabel();
        lblModelo = new javax.swing.JLabel();
        lblMotor = new javax.swing.JLabel();
        lblMotor1 = new javax.swing.JLabel();
        lblChasis = new javax.swing.JLabel();
        lblPlacaNuevo2 = new javax.swing.JLabel();
        lblPlacaNuevo6 = new javax.swing.JLabel();
        cbxMarca = new javax.swing.JComboBox();
        cbxClase = new javax.swing.JComboBox();
        cbxTipo = new javax.swing.JComboBox();
        yearAñoFabricacion = new com.toedter.calendar.JYearChooser();
        txtModelo = new javax.swing.JTextField();
        txtMotor = new javax.swing.JTextField();
        txtColor = new javax.swing.JTextField();
        txtChasis = new javax.swing.JTextField();
        txtCilindraje = new javax.swing.JTextField();
        txtPrecio = new javax.swing.JTextField();
        jLabel31 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        jLabel35 = new javax.swing.JLabel();
        jLabel36 = new javax.swing.JLabel();
        jLabel37 = new javax.swing.JLabel();
        jLabel38 = new javax.swing.JLabel();
        jLabel39 = new javax.swing.JLabel();
        jLabel40 = new javax.swing.JLabel();
        btnNuevaMarca = new javax.swing.JButton();
        btnNuevaClase = new javax.swing.JButton();
        btnNuevoTipo = new javax.swing.JButton();
        pnlImagen = new org.edisoncor.gui.panel.PanelImage();
        jLabel7 = new javax.swing.JLabel();
        btnAbrir = new javax.swing.JButton();
        txtFoto = new javax.swing.JTextField();
        txtPrecioVenta = new javax.swing.JTextField();
        lblPlacaNuevo4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        panelRound3 = new org.edisoncor.gui.panel.PanelRound();
        lblChasis1 = new javax.swing.JLabel();
        cbxCiudad = new javax.swing.JComboBox();
        jLabel22 = new javax.swing.JLabel();
        lblPlacaNuevo1 = new javax.swing.JLabel();
        dateFecha = new com.toedter.calendar.JYearChooser();
        jLabel23 = new javax.swing.JLabel();
        lblPlacaNuevo5 = new javax.swing.JLabel();
        txtAnombre = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        lblPlacaNuevo8 = new javax.swing.JLabel();
        lblPlacaNuevo9 = new javax.swing.JLabel();
        jButton2 = new javax.swing.JButton();
        btnGuardarVehiculo = new javax.swing.JButton();
        panelImage4 = new org.edisoncor.gui.panel.PanelImage();
        panelRect2 = new org.edisoncor.gui.panel.PanelRect();
        jScrollPane2 = new javax.swing.JScrollPane();
        tblModificaciones = new javax.swing.JTable();
        btnAgregar = new javax.swing.JButton();
        jLabel28 = new javax.swing.JLabel();
        vistaReparacion = new javax.swing.JDialog();
        panelImage5 = new org.edisoncor.gui.panel.PanelImage();
        panelRound4 = new org.edisoncor.gui.panel.PanelRound();
        txtDescripcionModificacion = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        txtPrecioModificacion = new javax.swing.JTextField();
        cbxTipoModificacion = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        btnAñadirModificacion = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        panelImage1 = new org.edisoncor.gui.panel.PanelImage();
        panelRound1 = new org.edisoncor.gui.panel.PanelRound();
        txtCriterio = new javax.swing.JTextField();
        lblPlacaNuevo3 = new javax.swing.JLabel();
        btnBuscar = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        panelRect1 = new org.edisoncor.gui.panel.PanelRect();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblVehiculo = new javax.swing.JTable();
        btnEditar = new javax.swing.JButton();
        btnNuevoVehiculo = new javax.swing.JButton();
        lblPlacaNuevo7 = new javax.swing.JLabel();
        btnSalir = new javax.swing.JButton();
        lblPlacaNuevo10 = new javax.swing.JLabel();

        vistaVehiculo.setTitle("Editar Vehículo");
        vistaVehiculo.setAlwaysOnTop(true);
        vistaVehiculo.setBackground(new java.awt.Color(1, 1, 1));
        vistaVehiculo.setMinimumSize(new java.awt.Dimension(733, 770));
        vistaVehiculo.setResizable(false);

        PanelNuevoVehiculo.setBackground(new java.awt.Color(0, 0, 0));

        panelImage2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/eddycar/jproyeddycar/negocio/Imagenes/pantalla.jpg"))); // NOI18N

        lblPlacaNuevo.setFont(new java.awt.Font("GentiumAlt", 0, 13));
        lblPlacaNuevo.setForeground(new java.awt.Color(255, 255, 255));
        lblPlacaNuevo.setText("Placa:");

        jLabel14.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel14.setForeground(new java.awt.Color(255, 0, 0));
        jLabel14.setText("*");

        lblTelfCel2.setFont(new java.awt.Font("GentiumAlt", 0, 13));
        lblTelfCel2.setForeground(new java.awt.Color(255, 255, 255));
        lblTelfCel2.setText("Marca:");

        lblTelfCel.setFont(new java.awt.Font("GentiumAlt", 0, 13));
        lblTelfCel.setForeground(new java.awt.Color(255, 255, 255));
        lblTelfCel.setText("Clase:");

        lblTelfCel1.setFont(new java.awt.Font("GentiumAlt", 0, 13));
        lblTelfCel1.setForeground(new java.awt.Color(255, 255, 255));
        lblTelfCel1.setText("Tipo:");

        lblMotor2.setFont(new java.awt.Font("GentiumAlt", 0, 13));
        lblMotor2.setForeground(new java.awt.Color(255, 255, 255));
        lblMotor2.setText("Año Fabricación:");

        lblModelo.setFont(new java.awt.Font("GentiumAlt", 0, 13));
        lblModelo.setForeground(new java.awt.Color(255, 255, 255));
        lblModelo.setText("Modelo:");

        lblMotor.setFont(new java.awt.Font("GentiumAlt", 0, 13));
        lblMotor.setForeground(new java.awt.Color(255, 255, 255));
        lblMotor.setText("Número de Motor:");

        lblMotor1.setFont(new java.awt.Font("GentiumAlt", 0, 13));
        lblMotor1.setForeground(new java.awt.Color(255, 255, 255));
        lblMotor1.setText("Color:");

        lblChasis.setFont(new java.awt.Font("GentiumAlt", 0, 13));
        lblChasis.setForeground(new java.awt.Color(255, 255, 255));
        lblChasis.setText("Número de Chasis:");

        lblPlacaNuevo2.setFont(new java.awt.Font("GentiumAlt", 0, 13));
        lblPlacaNuevo2.setForeground(new java.awt.Color(255, 255, 255));
        lblPlacaNuevo2.setText("Cilindraje:");

        lblPlacaNuevo6.setFont(new java.awt.Font("GentiumAlt", 0, 13));
        lblPlacaNuevo6.setForeground(new java.awt.Color(255, 255, 255));
        lblPlacaNuevo6.setText("Precio Compra:");

        jLabel31.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel31.setForeground(new java.awt.Color(255, 0, 0));
        jLabel31.setText("*");

        jLabel32.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel32.setForeground(new java.awt.Color(255, 0, 0));
        jLabel32.setText("*");

        jLabel33.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel33.setForeground(new java.awt.Color(255, 0, 0));
        jLabel33.setText("*");

        jLabel34.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel34.setForeground(new java.awt.Color(255, 0, 0));
        jLabel34.setText("*");

        jLabel35.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel35.setForeground(new java.awt.Color(255, 0, 0));
        jLabel35.setText("*");

        jLabel36.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel36.setForeground(new java.awt.Color(255, 0, 0));
        jLabel36.setText("*");

        jLabel37.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel37.setForeground(new java.awt.Color(255, 0, 0));
        jLabel37.setText("*");

        jLabel38.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel38.setForeground(new java.awt.Color(255, 0, 0));
        jLabel38.setText("*");

        jLabel39.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel39.setForeground(new java.awt.Color(255, 0, 0));
        jLabel39.setText("*");

        jLabel40.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel40.setForeground(new java.awt.Color(255, 0, 0));
        jLabel40.setText("*");

        btnNuevaMarca.setText("Nueva Marca");
        btnNuevaMarca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNuevaMarcaActionPerformed(evt);
            }
        });

        btnNuevaClase.setText("Nueva Clase");
        btnNuevaClase.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNuevaClaseActionPerformed(evt);
            }
        });

        btnNuevoTipo.setText("Nuevo Tipo");
        btnNuevoTipo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNuevoTipoActionPerformed(evt);
            }
        });

        pnlImagen.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(189, 189, 189)));
        pnlImagen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/eddycar/jproyeddycar/negocio/Imagenes/portada4.jpg"))); // NOI18N

        javax.swing.GroupLayout pnlImagenLayout = new javax.swing.GroupLayout(pnlImagen);
        pnlImagen.setLayout(pnlImagenLayout);
        pnlImagenLayout.setHorizontalGroup(
            pnlImagenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 232, Short.MAX_VALUE)
        );
        pnlImagenLayout.setVerticalGroup(
            pnlImagenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 195, Short.MAX_VALUE)
        );

        jLabel7.setFont(new java.awt.Font("GentiumAlt", 0, 13));
        jLabel7.setForeground(new java.awt.Color(255, 255, 255));
        jLabel7.setText("Foto:");

        btnAbrir.setText("Buscar");
        btnAbrir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAbrirActionPerformed(evt);
            }
        });

        txtFoto.setEditable(false);

        txtPrecioVenta.setText("0");

        lblPlacaNuevo4.setFont(new java.awt.Font("GentiumAlt", 0, 13));
        lblPlacaNuevo4.setForeground(new java.awt.Color(255, 255, 255));
        lblPlacaNuevo4.setText("Precio Venta:");

        jLabel5.setFont(new java.awt.Font("GentiumAlt", 1, 13));
        jLabel5.setForeground(new java.awt.Color(255, 255, 255));
        jLabel5.setText("obligatorios.");

        jLabel4.setFont(new java.awt.Font("GentiumAlt", 1, 13));
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setText("Campos");

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel8.setForeground(new java.awt.Color(255, 0, 0));
        jLabel8.setText("*");

        javax.swing.GroupLayout panelRound2Layout = new javax.swing.GroupLayout(panelRound2);
        panelRound2.setLayout(panelRound2Layout);
        panelRound2Layout.setHorizontalGroup(
            panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRound2Layout.createSequentialGroup()
                .addGap(88, 88, 88)
                .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblTelfCel2)
                    .addComponent(lblTelfCel)
                    .addComponent(lblTelfCel1)
                    .addComponent(lblMotor2)
                    .addComponent(lblModelo)
                    .addComponent(lblMotor)
                    .addComponent(lblMotor1)
                    .addComponent(lblChasis)
                    .addComponent(lblPlacaNuevo2)
                    .addComponent(lblPlacaNuevo6)
                    .addComponent(lblPlacaNuevo))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelRound2Layout.createSequentialGroup()
                        .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(panelRound2Layout.createSequentialGroup()
                                .addComponent(txtPlacaNuevo, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel14))
                            .addGroup(panelRound2Layout.createSequentialGroup()
                                .addComponent(yearAñoFabricacion, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel34))
                            .addComponent(txtModelo, javax.swing.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE)
                            .addGroup(panelRound2Layout.createSequentialGroup()
                                .addComponent(txtMotor, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel36))
                            .addGroup(panelRound2Layout.createSequentialGroup()
                                .addComponent(txtColor, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel37))
                            .addComponent(txtChasis, javax.swing.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE)
                            .addComponent(cbxMarca, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(cbxClase, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(cbxTipo, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelRound2Layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(panelRound2Layout.createSequentialGroup()
                                        .addComponent(jLabel33)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(btnNuevoTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(panelRound2Layout.createSequentialGroup()
                                        .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel38)
                                            .addComponent(jLabel35))
                                        .addGap(18, 18, 18)
                                        .addComponent(pnlImagen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(panelRound2Layout.createSequentialGroup()
                                        .addComponent(jLabel31)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(btnNuevaMarca, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(panelRound2Layout.createSequentialGroup()
                                        .addComponent(jLabel32)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(btnNuevaClase, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addGroup(panelRound2Layout.createSequentialGroup()
                                .addGap(109, 109, 109)
                                .addComponent(btnAbrir, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                    .addGroup(panelRound2Layout.createSequentialGroup()
                        .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(txtCilindraje)
                            .addComponent(txtPrecio, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel39)
                            .addGroup(panelRound2Layout.createSequentialGroup()
                                .addComponent(jLabel40)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel7)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtFoto, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(42, Short.MAX_VALUE))
            .addGroup(panelRound2Layout.createSequentialGroup()
                .addGap(127, 127, 127)
                .addComponent(lblPlacaNuevo4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtPrecioVenta, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 120, Short.MAX_VALUE)
                .addComponent(jLabel8)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel5)
                .addGap(71, 71, 71))
        );
        panelRound2Layout.setVerticalGroup(
            panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRound2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtPlacaNuevo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel14))
                    .addComponent(lblPlacaNuevo))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(panelRound2Layout.createSequentialGroup()
                        .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cbxMarca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblTelfCel2)
                            .addComponent(jLabel31)
                            .addComponent(btnNuevaMarca))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cbxClase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblTelfCel)
                            .addComponent(jLabel32)
                            .addComponent(btnNuevaClase))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelRound2Layout.createSequentialGroup()
                                .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(cbxTipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblTelfCel1)
                                    .addComponent(jLabel33))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(yearAñoFabricacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jLabel34)
                                        .addComponent(btnAbrir, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addComponent(btnNuevoTipo)))
                    .addComponent(lblMotor2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelRound2Layout.createSequentialGroup()
                        .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtModelo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblModelo)
                            .addComponent(jLabel35))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtMotor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblMotor)
                            .addComponent(jLabel36))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtColor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblMotor1)
                            .addComponent(jLabel37))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 43, Short.MAX_VALUE)
                        .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtChasis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblChasis)
                            .addComponent(jLabel38))
                        .addGap(7, 7, 7)
                        .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtCilindraje, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblPlacaNuevo2)
                            .addComponent(jLabel39)))
                    .addComponent(pnlImagen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtPrecio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblPlacaNuevo6)
                    .addComponent(jLabel40)
                    .addComponent(jLabel7)
                    .addComponent(txtFoto, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(7, 7, 7)
                .addGroup(panelRound2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPlacaNuevo4)
                    .addComponent(txtPrecioVenta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(jLabel4)
                    .addComponent(jLabel8))
                .addGap(23, 23, 23))
        );

        lblChasis1.setFont(new java.awt.Font("GentiumAlt", 0, 13));
        lblChasis1.setForeground(new java.awt.Color(255, 255, 255));
        lblChasis1.setText("Matriculado En:");

        cbxCiudad.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Carchi", "Imbabura", "Pichincha", "Cotopaxi", "Tungurahua", "Bolívar", "Chimborazo", "Cañar", "Azuay", "Loja", "Sto. Domingo de los Tsachilas", "Sucumbíos", "Napo", "Pastaza", "Orellana", "Morona Santiago", "Zamora Chinchipe", "Esmeraldas", "Manabí", "Guayas", "Los Ríos", "El Oro", "Santa Elena" }));
        cbxCiudad.setOpaque(false);

        jLabel22.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel22.setForeground(new java.awt.Color(255, 0, 0));
        jLabel22.setText("*");

        lblPlacaNuevo1.setFont(new java.awt.Font("GentiumAlt", 0, 13));
        lblPlacaNuevo1.setForeground(new java.awt.Color(255, 255, 255));
        lblPlacaNuevo1.setText("Año de Matriculación:");

        jLabel23.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel23.setForeground(new java.awt.Color(255, 0, 0));
        jLabel23.setText("*");

        lblPlacaNuevo5.setFont(new java.awt.Font("GentiumAlt", 0, 13));
        lblPlacaNuevo5.setForeground(new java.awt.Color(255, 255, 255));
        lblPlacaNuevo5.setText("A nombre de:");

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel6.setForeground(new java.awt.Color(255, 0, 0));
        jLabel6.setText("*");

        javax.swing.GroupLayout panelRound3Layout = new javax.swing.GroupLayout(panelRound3);
        panelRound3.setLayout(panelRound3Layout);
        panelRound3Layout.setHorizontalGroup(
            panelRound3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRound3Layout.createSequentialGroup()
                .addGap(72, 72, 72)
                .addGroup(panelRound3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblChasis1)
                    .addComponent(lblPlacaNuevo1)
                    .addComponent(lblPlacaNuevo5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelRound3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelRound3Layout.createSequentialGroup()
                        .addComponent(dateFecha, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel23))
                    .addGroup(panelRound3Layout.createSequentialGroup()
                        .addComponent(cbxCiudad, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel22))
                    .addGroup(panelRound3Layout.createSequentialGroup()
                        .addComponent(txtAnombre, javax.swing.GroupLayout.PREFERRED_SIZE, 258, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel6)))
                .addContainerGap(205, Short.MAX_VALUE))
        );
        panelRound3Layout.setVerticalGroup(
            panelRound3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRound3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelRound3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblChasis1)
                    .addComponent(cbxCiudad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel22))
                .addGroup(panelRound3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelRound3Layout.createSequentialGroup()
                        .addGroup(panelRound3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelRound3Layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(dateFecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(panelRound3Layout.createSequentialGroup()
                                .addGap(12, 12, 12)
                                .addComponent(jLabel23)))
                        .addGap(12, 12, 12)
                        .addGroup(panelRound3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtAnombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblPlacaNuevo5)
                            .addComponent(jLabel6)))
                    .addGroup(panelRound3Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(lblPlacaNuevo1)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        lblPlacaNuevo8.setFont(new java.awt.Font("GentiumAlt", 1, 13));
        lblPlacaNuevo8.setForeground(new java.awt.Color(255, 255, 255));
        lblPlacaNuevo8.setText("Características");

        lblPlacaNuevo9.setFont(new java.awt.Font("GentiumAlt", 1, 13));
        lblPlacaNuevo9.setForeground(new java.awt.Color(255, 255, 255));
        lblPlacaNuevo9.setText("Datos de Matrícula del vehículo:");

        jButton2.setText("Cancelar");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        btnGuardarVehiculo.setText("Guardar Vehículo");
        btnGuardarVehiculo.setBorder(btnAbrir.getBorder());
        btnGuardarVehiculo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGuardarVehiculoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelImage2Layout = new javax.swing.GroupLayout(panelImage2);
        panelImage2.setLayout(panelImage2Layout);
        panelImage2Layout.setHorizontalGroup(
            panelImage2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelImage2Layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(lblPlacaNuevo8)
                .addContainerGap())
            .addGroup(panelImage2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelImage2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblPlacaNuevo9)
                    .addGroup(panelImage2Layout.createSequentialGroup()
                        .addGroup(panelImage2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(panelRound3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(panelRound2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
            .addGroup(panelImage2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 417, Short.MAX_VALUE)
                .addComponent(btnGuardarVehiculo, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        panelImage2Layout.setVerticalGroup(
            panelImage2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelImage2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblPlacaNuevo8)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelRound2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(5, 5, 5)
                .addComponent(lblPlacaNuevo9)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelRound3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelImage2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton2)
                    .addComponent(btnGuardarVehiculo, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        tabbedPaneRound1.addTab("Características", panelImage2);

        panelImage4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/eddycar/jproyeddycar/negocio/Imagenes/pantalla.jpg"))); // NOI18N

        jScrollPane2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        org.jdesktop.beansbinding.ELProperty eLProperty = org.jdesktop.beansbinding.ELProperty.create("${lisObservableModificaciones}");
        org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, eLProperty, tblModificaciones);
        org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${nombre}"));
        columnBinding.setColumnName("Nombre");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${precio}"));
        columnBinding.setColumnName("Precio");
        columnBinding.setColumnClass(Double.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${tipo}"));
        columnBinding.setColumnName("Tipo");
        columnBinding.setColumnClass(org.eddycar.jproyeddycar.contrato.modelo.TipoModificacion.class);
        columnBinding.setEditable(false);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        jScrollPane2.setViewportView(tblModificaciones);

        btnAgregar.setText("Agregar");
        btnAgregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAgregarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelRect2Layout = new javax.swing.GroupLayout(panelRect2);
        panelRect2.setLayout(panelRect2Layout);
        panelRect2Layout.setHorizontalGroup(
            panelRect2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRect2Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(27, 27, 27)
                .addComponent(btnAgregar, javax.swing.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE)
                .addContainerGap())
        );
        panelRect2Layout.setVerticalGroup(
            panelRect2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRect2Layout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addGroup(panelRect2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnAgregar)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 475, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(34, Short.MAX_VALUE))
        );

        jLabel28.setFont(new java.awt.Font("Flubber", 1, 18));
        jLabel28.setForeground(new java.awt.Color(255, 255, 255));
        jLabel28.setText("Lista de Accesorios/Extras.");

        javax.swing.GroupLayout panelImage4Layout = new javax.swing.GroupLayout(panelImage4);
        panelImage4.setLayout(panelImage4Layout);
        panelImage4Layout.setHorizontalGroup(
            panelImage4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelImage4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelImage4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(panelRect2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel28))
                .addContainerGap(34, Short.MAX_VALUE))
        );
        panelImage4Layout.setVerticalGroup(
            panelImage4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelImage4Layout.createSequentialGroup()
                .addGap(11, 11, 11)
                .addComponent(jLabel28)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelRect2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(122, Short.MAX_VALUE))
        );

        tabbedPaneRound1.addTab("Reparaciones", panelImage4);

        javax.swing.GroupLayout PanelNuevoVehiculoLayout = new javax.swing.GroupLayout(PanelNuevoVehiculo);
        PanelNuevoVehiculo.setLayout(PanelNuevoVehiculoLayout);
        PanelNuevoVehiculoLayout.setHorizontalGroup(
            PanelNuevoVehiculoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabbedPaneRound1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        PanelNuevoVehiculoLayout.setVerticalGroup(
            PanelNuevoVehiculoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabbedPaneRound1, javax.swing.GroupLayout.DEFAULT_SIZE, 727, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout vistaVehiculoLayout = new javax.swing.GroupLayout(vistaVehiculo.getContentPane());
        vistaVehiculo.getContentPane().setLayout(vistaVehiculoLayout);
        vistaVehiculoLayout.setHorizontalGroup(
            vistaVehiculoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(PanelNuevoVehiculo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        vistaVehiculoLayout.setVerticalGroup(
            vistaVehiculoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(vistaVehiculoLayout.createSequentialGroup()
                .addComponent(PanelNuevoVehiculo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        vistaReparacion.setTitle("Nueva Reparación");
        vistaReparacion.setAlwaysOnTop(true);
        vistaReparacion.setMinimumSize(new java.awt.Dimension(450, 220));
        vistaReparacion.setResizable(false);

        panelImage5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/eddycar/jproyeddycar/negocio/Imagenes/pantalla.jpg"))); // NOI18N

        jLabel25.setFont(new java.awt.Font("GentiumAlt", 1, 13));
        jLabel25.setForeground(new java.awt.Color(255, 255, 255));
        jLabel25.setText("Descripción:");

        jLabel24.setFont(new java.awt.Font("GentiumAlt", 1, 13));
        jLabel24.setForeground(new java.awt.Color(255, 255, 255));
        jLabel24.setText("Precio:");

        cbxTipoModificacion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ACCESORIO", "REPARACION" }));

        jLabel3.setFont(new java.awt.Font("GentiumAlt", 1, 13));
        jLabel3.setForeground(new java.awt.Color(255, 255, 255));
        jLabel3.setText("Tipo:");

        btnAñadirModificacion.setText("Guardar");
        btnAñadirModificacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAñadirModificacionActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelRound4Layout = new javax.swing.GroupLayout(panelRound4);
        panelRound4.setLayout(panelRound4Layout);
        panelRound4Layout.setHorizontalGroup(
            panelRound4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRound4Layout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addGroup(panelRound4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel25)
                    .addComponent(jLabel24)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelRound4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtDescripcionModificacion, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtPrecioModificacion, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(panelRound4Layout.createSequentialGroup()
                        .addComponent(cbxTipoModificacion, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnAñadirModificacion, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE)))
                .addContainerGap(27, Short.MAX_VALUE))
        );
        panelRound4Layout.setVerticalGroup(
            panelRound4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRound4Layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(panelRound4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtDescripcionModificacion, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelRound4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(panelRound4Layout.createSequentialGroup()
                        .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18))
                    .addGroup(panelRound4Layout.createSequentialGroup()
                        .addComponent(txtPrecioModificacion, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(11, 11, 11)))
                .addGroup(panelRound4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(panelRound4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(cbxTipoModificacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btnAñadirModificacion, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(20, Short.MAX_VALUE))
        );

        jLabel2.setFont(new java.awt.Font("Flubber", 1, 18));
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("Agregar Nuevo Extra/Accesorio");

        javax.swing.GroupLayout panelImage5Layout = new javax.swing.GroupLayout(panelImage5);
        panelImage5.setLayout(panelImage5Layout);
        panelImage5Layout.setHorizontalGroup(
            panelImage5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelImage5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelRound4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(panelImage5Layout.createSequentialGroup()
                .addGap(56, 56, 56)
                .addComponent(jLabel2)
                .addContainerGap(63, Short.MAX_VALUE))
        );
        panelImage5Layout.setVerticalGroup(
            panelImage5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelImage5Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelRound4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        javax.swing.GroupLayout vistaReparacionLayout = new javax.swing.GroupLayout(vistaReparacion.getContentPane());
        vistaReparacion.getContentPane().setLayout(vistaReparacionLayout);
        vistaReparacionLayout.setHorizontalGroup(
            vistaReparacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelImage5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        vistaReparacionLayout.setVerticalGroup(
            vistaReparacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelImage5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("Administrar Vehiculo");
        setBackground(new java.awt.Color(0, 0, 0));
        setResizable(false);

        jPanel4.setBackground(new java.awt.Color(0, 0, 0));

        panelImage1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/eddycar/jproyeddycar/negocio/Imagenes/pantalla.jpg"))); // NOI18N
        panelImage1.setInheritsPopupMenu(true);

        lblPlacaNuevo3.setFont(new java.awt.Font("GentiumAlt", 1, 13));
        lblPlacaNuevo3.setForeground(new java.awt.Color(255, 255, 255));
        lblPlacaNuevo3.setText("Placa/Marca:");

        btnBuscar.setFont(new java.awt.Font("Tahoma", 0, 10));
        btnBuscar.setText("Buscar");
        btnBuscar.setBorder(btnAbrir.getBorder());
        btnBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarActionPerformed(evt);
            }
        });

        jButton1.setText("Limpiar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelRound1Layout = new javax.swing.GroupLayout(panelRound1);
        panelRound1.setLayout(panelRound1Layout);
        panelRound1Layout.setHorizontalGroup(
            panelRound1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRound1Layout.createSequentialGroup()
                .addGap(27, 27, 27)
                .addGroup(panelRound1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(panelRound1Layout.createSequentialGroup()
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btnBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(panelRound1Layout.createSequentialGroup()
                        .addComponent(lblPlacaNuevo3)
                        .addGap(18, 18, 18)
                        .addComponent(txtCriterio, javax.swing.GroupLayout.PREFERRED_SIZE, 482, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(57, Short.MAX_VALUE))
        );
        panelRound1Layout.setVerticalGroup(
            panelRound1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRound1Layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addGroup(panelRound1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtCriterio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblPlacaNuevo3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelRound1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnBuscar)
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(24, Short.MAX_VALUE))
        );

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${lisObservableVehiculo}");
        jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, eLProperty, tblVehiculo);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${placa}"));
        columnBinding.setColumnName("Placa");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${marca}"));
        columnBinding.setColumnName("Marca");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${clase}"));
        columnBinding.setColumnName("Clase");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${color}"));
        columnBinding.setColumnName("Color");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        jScrollPane1.setViewportView(tblVehiculo);

        btnEditar.setFont(new java.awt.Font("Tahoma", 0, 10));
        btnEditar.setText("Editar");
        btnEditar.setBorder(btnAbrir.getBorder());
        btnEditar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEditarActionPerformed(evt);
            }
        });

        btnNuevoVehiculo.setFont(new java.awt.Font("Tahoma", 0, 10));
        btnNuevoVehiculo.setText("Nuevo");
        btnNuevoVehiculo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNuevoVehiculoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelRect1Layout = new javax.swing.GroupLayout(panelRect1);
        panelRect1.setLayout(panelRect1Layout);
        panelRect1Layout.setHorizontalGroup(
            panelRect1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelRect1Layout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 506, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(panelRect1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(btnNuevoVehiculo, javax.swing.GroupLayout.DEFAULT_SIZE, 97, Short.MAX_VALUE)
                    .addComponent(btnEditar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(35, 35, 35))
        );
        panelRect1Layout.setVerticalGroup(
            panelRect1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRect1Layout.createSequentialGroup()
                .addGroup(panelRect1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelRect1Layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(btnNuevoVehiculo)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnEditar))
                    .addGroup(panelRect1Layout.createSequentialGroup()
                        .addGap(25, 25, 25)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(27, Short.MAX_VALUE))
        );

        lblPlacaNuevo7.setFont(new java.awt.Font("GentiumAlt", 1, 13));
        lblPlacaNuevo7.setForeground(new java.awt.Color(255, 255, 255));
        lblPlacaNuevo7.setText("Criterio de Búsqueda:");

        btnSalir.setFont(new java.awt.Font("Tahoma", 0, 12));
        btnSalir.setText("Salir");
        btnSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSalirActionPerformed(evt);
            }
        });

        lblPlacaNuevo10.setFont(new java.awt.Font("GentiumAlt", 1, 13));
        lblPlacaNuevo10.setForeground(new java.awt.Color(255, 255, 255));
        lblPlacaNuevo10.setText("Resultado de Búsqueda:");

        javax.swing.GroupLayout panelImage1Layout = new javax.swing.GroupLayout(panelImage1);
        panelImage1.setLayout(panelImage1Layout);
        panelImage1Layout.setHorizontalGroup(
            panelImage1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelImage1Layout.createSequentialGroup()
                .addGroup(panelImage1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelImage1Layout.createSequentialGroup()
                        .addGap(22, 22, 22)
                        .addGroup(panelImage1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblPlacaNuevo10)
                            .addComponent(lblPlacaNuevo7)
                            .addComponent(panelRound1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelImage1Layout.createSequentialGroup()
                        .addGap(22, 22, 22)
                        .addComponent(panelRect1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelImage1Layout.createSequentialGroup()
                        .addContainerGap(572, Short.MAX_VALUE)
                        .addComponent(btnSalir, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        panelImage1Layout.setVerticalGroup(
            panelImage1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelImage1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblPlacaNuevo7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelRound1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblPlacaNuevo10)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelRect1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnSalir, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelImage1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelImage1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        bindingGroup.bind();

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
        lisObservableVehiculo.clear();
        tblVehiculo.repaint();
        try {
            lisObservableVehiculo.addAll(vehiculoUCC.buscar(txtCriterio.getText()));
            tblVehiculo.repaint();
        } catch (ArrayIndexOutOfBoundsException e) {
        } catch (NullPointerException e) {
        }
        try {
            if (txtCriterio.getText().isEmpty()) {
                lisObservableVehiculo.addAll(vehiculoUCC.getVehiculoDao().buscarTodos());
                tblVehiculo.repaint();
            }
        } catch (ArrayIndexOutOfBoundsException e) {
        } catch (NullPointerException e) {
        }
    }//GEN-LAST:event_btnBuscarActionPerformed

    private void btnEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditarActionPerformed
        try {
            lisObservableModificaciones.clear();
            tblModificaciones.repaint();
            vehiculoUCC.setVehiculo(vehiculoUCC.getVehiculoDao().buscarId(tblVehiculo.getValueAt(tblVehiculo.getSelectedRow(), 0) + ""));
            vehiculoUCC.setModificaciones(vehiculoUCC.getVehiculo().getModificaciones());
            lisObservableModificaciones.addAll(vehiculoUCC.getModificaciones());
            System.out.println("SI paso");
            edit = true;
            abilitarCambos(true);
            reemplazarCampos(vehiculoUCC.getVehiculo());
            this.vistaVehiculo.setAlwaysOnTop(true);
            this.vistaVehiculo.setLocationRelativeTo(this);
            this.vistaVehiculo.setVisible(true);
            this.setVisible(false);
        } catch (ArrayIndexOutOfBoundsException e) {
        }

    }//GEN-LAST:event_btnEditarActionPerformed

    private void btnGuardarVehiculoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarVehiculoActionPerformed
        System.out.println(lisObservableModificaciones.size());
        try {
            if (txtAnombre.getText().isEmpty() != true && txtCilindraje.getText().isEmpty() != true && txtPlacaNuevo.getText().isEmpty() != true && cbxMarca.getSelectedItem().toString().equals("NINGUNO") != true && cbxTipo.getSelectedItem().toString().equals("NINGUNO") != true && txtModelo.getText().isEmpty() != true && txtColor.getText().isEmpty() != true && txtMotor.getText().isEmpty() != true && txtChasis.getText().isEmpty() != true && txtPrecio.getText().isEmpty() != true && cbxClase.getSelectedItem().toString().equals("NINGUNO") != true && String.valueOf(dateFecha.getYear()).isEmpty() != true) {
                if (Double.parseDouble(txtCilindraje.getText()) >= 1 && Double.parseDouble(txtCilindraje.getText()) <= 9000) {
                    guardarDatos();
                    if (edit == true) {
                        vehiculoUCC.getVehiculo().setModificaciones(vehiculoUCC.getModificaciones());
                        vehiculoUCC.getVehiculoDao().actualizar(vehiculoUCC.getVehiculo());
                        vaciarCambios();
                        abilitarCambos(false);
                        JOptionPane.showMessageDialog(this, "Vehículo Actualizado");
                    } else {
                        vehiculoUCC.getVehiculo().getModificaciones().addAll(vehiculoUCC.getModificaciones());
                        vehiculoUCC.guardar(vehiculoUCC.getVehiculo());
                        vaciarCambios();
                        abilitarCambos(false);
                        vistaVehiculo.setVisible(false);
                        JOptionPane.showMessageDialog(this, "Vehículo Guardado");
                        this.setVisible(true);
                    }
                    this.vistaVehiculo.setVisible(false);
                    this.setVisible(true);
                } else {
                    JOptionPane.showMessageDialog(this, "El cilindraje no puede repasar el límite: 1 - 9000 ", "Error de Datos", JOptionPane.ERROR_MESSAGE);
                }
            } else {
                JOptionPane.showMessageDialog(this, "Faltan  Datos Obligatorios", "Error de Datos", JOptionPane.ERROR_MESSAGE);

            }
        } catch (NullPointerException e) {
            JOptionPane.showMessageDialog(this, "Faltan Datos" + e, "Error de Datos", JOptionPane.ERROR_MESSAGE);
        } catch (ArithmeticException e) {
            JOptionPane.showMessageDialog(this, "No puede ser el precio de Venta menor que el de compra " + e, "Error de Datos", JOptionPane.ERROR_MESSAGE);
        } catch (NumberFormatException e) {
            JOptionPane.showMessageDialog(this, "Precio Compra o Precio Venta o Cilindraje Incorrecto: " + "\nError: " + e, "Error de Datos", JOptionPane.ERROR_MESSAGE);
        }
}//GEN-LAST:event_btnGuardarVehiculoActionPerformed

    private void btnAñadirModificacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAñadirModificacionActionPerformed
        vistaVehiculo.setAlwaysOnTop(false);
        try {
            if (txtPrecioModificacion.getText() != null) {
                vehiculoUCC.setModificacion(new Modificacion());
                vehiculoUCC.getModificacion().setNombre(txtDescripcionModificacion.getText());
                vehiculoUCC.getModificacion().setPrecio(Double.parseDouble(txtPrecioModificacion.getText()));
                vehiculoUCC.getModificacion().setTipom(TipoModificacion.valueOf(cbxTipoModificacion.getSelectedItem().toString()));
                vehiculoUCC.getModificacion().setVehiculo(vehiculoUCC.getVehiculo());
                vehiculoUCC.getModificaciones().add(vehiculoUCC.getModificacion());
                lisObservableModificaciones.add(vehiculoUCC.getModificacion());
                tblModificaciones.repaint();
                vistaReparacion.setVisible(false);
            } else {
                vistaReparacion.setAlwaysOnTop(false);
                JOptionPane.showMessageDialog(this, "Precio de Reparación/Accesorio incorrecto", "Error de Datos", JOptionPane.ERROR_MESSAGE);
            }
        } catch (NumberFormatException e) {
            vistaReparacion.setAlwaysOnTop(false);
            JOptionPane.showMessageDialog(this, "Datos Incorrectos", "Error de Datos", JOptionPane.ERROR_MESSAGE);
        }
    }//GEN-LAST:event_btnAñadirModificacionActionPerformed

    private void btnAbrirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAbrirActionPerformed
        JFileChooser chooser = new JFileChooser();
        FileNameExtensionFilter filter = new FileNameExtensionFilter("Solo imagenes", "jpg");
        f = new File("");
        chooser.setFileFilter(filter);
        chooser.showOpenDialog(this);
        f = chooser.getSelectedFile();
        txtFoto.setText(f.getPath());
        System.out.println(f.getPath());
        pnlImagen.setIcon(new javax.swing.ImageIcon(f.getPath()));
        pnlImagen.repaint();
}//GEN-LAST:event_btnAbrirActionPerformed

    private void btnSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalirActionPerformed
        dispose();
    }//GEN-LAST:event_btnSalirActionPerformed

    private void btnNuevaMarcaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevaMarcaActionPerformed
        vistaVehiculo.setAlwaysOnTop(false);
        String nuevaMarca = String.valueOf(JOptionPane.showInputDialog("Marca: ")).toUpperCase();
        if (nuevaMarca.equals("NULL") != true) {
            if ((nuevaMarca.isEmpty() || nuevaMarca.length() <= 2) != true) {
                if (vehiculoUCC.existeMarca(nuevaMarca) == true) {
                    JOptionPane.showMessageDialog(this, "Marca ya existe", "Error de Datos", JOptionPane.ERROR_MESSAGE);
                } else {
                    Marca marca = new Marca(nuevaMarca);
                    vehiculoUCC.guardarMarca(marca);
                    cbxMarca.addItem(nuevaMarca);
                    cbxMarca.setSelectedItem(nuevaMarca);
                }
            } else {
                JOptionPane.showMessageDialog(this, "Marca Incorrecta", "Error de Datos", JOptionPane.ERROR_MESSAGE);
            }
        }
    }//GEN-LAST:event_btnNuevaMarcaActionPerformed

    private void btnNuevaClaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevaClaseActionPerformed
        vistaVehiculo.setAlwaysOnTop(false);
        String nuevaClase = String.valueOf(JOptionPane.showInputDialog("Clase: ")).toUpperCase();
        if (nuevaClase.equals("NULL") != true) {
            if ((nuevaClase.isEmpty() || nuevaClase.length() <= 3) != true) {
                if (vehiculoUCC.existeClase(nuevaClase) == true) {
                    JOptionPane.showMessageDialog(this, "Clase ya existe", "Error de Datos", JOptionPane.ERROR_MESSAGE);
                } else {
                    Clase clase = new Clase(nuevaClase);
                    vehiculoUCC.guardarClase(clase);
                    cbxClase.addItem(nuevaClase);
                    cbxClase.setSelectedItem(nuevaClase);
                }
            } else {
                JOptionPane.showMessageDialog(this, "Clase Incorrecta", "Error de Datos", JOptionPane.ERROR_MESSAGE);
            }
        }
    }//GEN-LAST:event_btnNuevaClaseActionPerformed

    private void btnNuevoTipoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoTipoActionPerformed
        vistaVehiculo.setAlwaysOnTop(false);
        String nuevoTipo = String.valueOf(JOptionPane.showInputDialog("Tipo: ")).toUpperCase();
        if (nuevoTipo.equals("NULL") != true) {
            if ((nuevoTipo.isEmpty() || nuevoTipo.length() <= 2) != true) {
                if (vehiculoUCC.existeTipo(nuevoTipo) == true) {
                    JOptionPane.showMessageDialog(this, "Tipo ya existe", "Error de Datos", JOptionPane.ERROR_MESSAGE);
                } else {
                    Tipo tipo = new Tipo(nuevoTipo);
                    vehiculoUCC.guardarTipo(tipo);
                    cbxTipo.addItem(nuevoTipo);
                    cbxTipo.setSelectedItem(nuevoTipo);
                }
            } else {
                JOptionPane.showMessageDialog(this, "Tipo Incorrecto", "Error de Datos", JOptionPane.ERROR_MESSAGE);
            }
        }
    }//GEN-LAST:event_btnNuevoTipoActionPerformed

    private void btnNuevoVehiculoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoVehiculoActionPerformed
        lisObservableModificaciones.clear();
        tblModificaciones.repaint();
        vehiculoUCC.getModificaciones().clear();
        vehiculoUCC.setVehiculo(new Vehiculo());
        vaciarCambios();
        abilitarCambos(true);
        this.setVisible(false);
        this.vistaVehiculo.setLocationRelativeTo(this);
        this.vistaVehiculo.setVisible(true);
    }//GEN-LAST:event_btnNuevoVehiculoActionPerformed

private void btnAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarActionPerformed
    vistaReparacion.setLocationRelativeTo(this);
    vistaReparacion.setVisible(true);
    txtPrecioModificacion.setText("");
    txtDescripcionModificacion.setText("");
}//GEN-LAST:event_btnAgregarActionPerformed

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
    this.vistaVehiculo.setVisible(false);
    this.setVisible(true);
}//GEN-LAST:event_jButton2ActionPerformed

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    txtCriterio.setText("");
    lisObservableVehiculo.clear();
    tblVehiculo.repaint();
}//GEN-LAST:event_jButton1ActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel PanelNuevoVehiculo;
    private javax.swing.JButton btnAbrir;
    private javax.swing.JButton btnAgregar;
    private javax.swing.JButton btnAñadirModificacion;
    private javax.swing.JButton btnBuscar;
    private javax.swing.JButton btnEditar;
    private javax.swing.JButton btnGuardarVehiculo;
    private javax.swing.JButton btnNuevaClase;
    private javax.swing.JButton btnNuevaMarca;
    private javax.swing.JButton btnNuevoTipo;
    private javax.swing.JButton btnNuevoVehiculo;
    private javax.swing.JButton btnSalir;
    private javax.swing.JComboBox cbxCiudad;
    private javax.swing.JComboBox cbxClase;
    private javax.swing.JComboBox cbxMarca;
    private javax.swing.JComboBox cbxTipo;
    private javax.swing.JComboBox cbxTipoModificacion;
    private com.toedter.calendar.JYearChooser dateFecha;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel lblChasis;
    private javax.swing.JLabel lblChasis1;
    private javax.swing.JLabel lblModelo;
    private javax.swing.JLabel lblMotor;
    private javax.swing.JLabel lblMotor1;
    private javax.swing.JLabel lblMotor2;
    private javax.swing.JLabel lblPlacaNuevo;
    private javax.swing.JLabel lblPlacaNuevo1;
    private javax.swing.JLabel lblPlacaNuevo10;
    private javax.swing.JLabel lblPlacaNuevo2;
    private javax.swing.JLabel lblPlacaNuevo3;
    private javax.swing.JLabel lblPlacaNuevo4;
    private javax.swing.JLabel lblPlacaNuevo5;
    private javax.swing.JLabel lblPlacaNuevo6;
    private javax.swing.JLabel lblPlacaNuevo7;
    private javax.swing.JLabel lblPlacaNuevo8;
    private javax.swing.JLabel lblPlacaNuevo9;
    private javax.swing.JLabel lblTelfCel;
    private javax.swing.JLabel lblTelfCel1;
    private javax.swing.JLabel lblTelfCel2;
    private org.edisoncor.gui.panel.PanelImage panelImage1;
    private org.edisoncor.gui.panel.PanelImage panelImage2;
    private org.edisoncor.gui.panel.PanelImage panelImage4;
    private org.edisoncor.gui.panel.PanelImage panelImage5;
    private org.edisoncor.gui.panel.PanelRect panelRect1;
    private org.edisoncor.gui.panel.PanelRect panelRect2;
    private org.edisoncor.gui.panel.PanelRound panelRound1;
    private org.edisoncor.gui.panel.PanelRound panelRound2;
    private org.edisoncor.gui.panel.PanelRound panelRound3;
    private org.edisoncor.gui.panel.PanelRound panelRound4;
    private org.edisoncor.gui.panel.PanelImage pnlImagen;
    private org.edisoncor.gui.tabbedPane.TabbedPaneRound tabbedPaneRound1;
    private javax.swing.JTable tblModificaciones;
    private javax.swing.JTable tblVehiculo;
    private javax.swing.JTextField txtAnombre;
    private javax.swing.JTextField txtChasis;
    private javax.swing.JTextField txtCilindraje;
    private javax.swing.JTextField txtColor;
    private javax.swing.JTextField txtCriterio;
    private javax.swing.JTextField txtDescripcionModificacion;
    private javax.swing.JTextField txtFoto;
    private javax.swing.JTextField txtModelo;
    private javax.swing.JTextField txtMotor;
    private javax.swing.JTextField txtPlacaNuevo;
    private javax.swing.JTextField txtPrecio;
    private javax.swing.JTextField txtPrecioModificacion;
    private javax.swing.JTextField txtPrecioVenta;
    private javax.swing.JDialog vistaReparacion;
    private javax.swing.JDialog vistaVehiculo;
    private com.toedter.calendar.JYearChooser yearAñoFabricacion;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables
    private List<Modificacion> lisModificacion = new ArrayList<Modificacion>();

    public List<Modificacion> getLisModificacion() {
        return lisModificacion;
    }

    public void setLisModificacion(List<Modificacion> lisModificacion) {
        this.lisModificacion = lisModificacion;
    }
    private ObservableList<Modificacion> lisObservableModificaciones = org.jdesktop.observablecollections.ObservableCollections.observableList(lisModificacion);

    public ObservableList<Modificacion> getLisObservableModificaciones() {
        return lisObservableModificaciones;
    }

    public void setLisObservableModificaciones(ObservableList<Modificacion> lisObservableModificaciones) {
        this.lisObservableModificaciones = lisObservableModificaciones;
    }
    private List<Vehiculo> lisVehiculo = new ArrayList<Vehiculo>();
    private ObservableList<Vehiculo> lisObservableVehiculo = org.jdesktop.observablecollections.ObservableCollections.observableList(lisVehiculo);

    public ObservableList<Vehiculo> getLisObservableVehiculo() {
        return lisObservableVehiculo;
    }

    public void setLisObservableVehiculo(ObservableList<Vehiculo> lisObservableVehiculo) {
        this.lisObservableVehiculo = lisObservableVehiculo;
    }

    public List<Vehiculo> getLisVehiculo() {
        return lisVehiculo;
    }

    public void setLisVehiculo(List<Vehiculo> lisVehiculo) {
        this.lisVehiculo = lisVehiculo;
    }

    public void abilitarCambos(boolean opc) {
        txtChasis.setEnabled(opc);
        txtColor.setEnabled(opc);
        cbxMarca.setEnabled(opc);
        txtModelo.setEnabled(opc);
        txtMotor.setEnabled(opc);
        cbxTipo.setEnabled(opc);
        txtPrecio.setEnabled(opc);
        yearAñoFabricacion.setEnabled(opc);
        cbxCiudad.setEnabled(opc);
        dateFecha.setEnabled(opc);
        cbxClase.setEnabled(opc);
        btnNuevaClase.setEnabled(opc);
        btnNuevaMarca.setEnabled(opc);
        btnNuevoTipo.setEnabled(opc);
        btnAbrir.setEnabled(opc);
        btnGuardarVehiculo.setEnabled(opc);
        txtCilindraje.setEnabled(opc);
        txtAnombre.setEnabled(opc);
        txtPrecioVenta.setEnabled(opc);
    }

    public void vaciarCambios() {
        txtChasis.setText("");
        txtColor.setText("");
        cbxMarca.setSelectedItem(0);
        txtModelo.setText("");
        txtMotor.setText("");
        txtPlacaNuevo.setText("");
        cbxTipo.setSelectedItem(0);
        cbxClase.setSelectedItem(0);
        txtPrecio.setText("");
        txtPrecioVenta.setText("0");
        yearAñoFabricacion.setYear(new Date().getYear() + 1900);
        cbxCiudad.setSelectedIndex(0);
        dateFecha.setYear(new Date().getYear());
        txtFoto.setText("");
        txtCilindraje.setText("");
        txtAnombre.setText("");
        pnlImagen.setIcon(new ImageIcon(getClass().getResource("/org/eddycar/jproyeddycar/negocio/Imagenes/portada4.jpg")));
        repaint();
    }

    public void reemplazarCampos(Vehiculo v1) {
        txtChasis.setText(v1.getNumChasis());
        txtFoto.setText(v1.getFoto());
        txtColor.setText(v1.getColor());
        cbxMarca.setSelectedItem(v1.getMarca());
        txtModelo.setText(v1.getModelo());
        txtMotor.setText(v1.getNumMotor());
        txtPlacaNuevo.setText(v1.getPlaca());
        cbxTipo.setSelectedItem(v1.getTipo());
        cbxClase.setSelectedItem(v1.getClase());
        txtPrecio.setText(String.valueOf(v1.getPrecioCompra()));
        yearAñoFabricacion.setYear(v1.getAnioFabricante());
        cbxCiudad.setSelectedItem(v1.getMatriculadoEn());
        dateFecha.setYear(Integer.parseInt(v1.getFecha()));
        txtFoto.setText(v1.getFoto());
        pnlImagen.setIcon(new javax.swing.ImageIcon(v1.getFoto()));
        pnlImagen.repaint();
        txtCilindraje.setText(v1.getCilindraje() + "");
        txtAnombre.setText(v1.getNombreMatricula());
        txtPrecioVenta.setText(v1.getPrecioExtra() + "");
        repaint();
    }

    public void cargarDatosCombos() {
        for (Marca m : daoMarca.buscarTodos()) {
            cbxMarca.addItem(m.getNombre());
        }
        for (Tipo t : daoTipo.buscarTodos()) {
            cbxTipo.addItem(t.getNombre());
        }
        for (Clase c : daoClase.buscarTodos()) {
            cbxClase.addItem(c.getNombre());
        }
    }

    private void guardarDatos() {
        vehiculoUCC.getVehiculo().setPlaca(txtPlacaNuevo.getText().toUpperCase());
        vehiculoUCC.getVehiculo().setMarca(cbxMarca.getSelectedItem().toString());
        vehiculoUCC.getVehiculo().setTipo(cbxTipo.getSelectedItem().toString());
        vehiculoUCC.getVehiculo().setModelo(txtModelo.getText().toUpperCase());
        vehiculoUCC.getVehiculo().setColor(txtColor.getText().toUpperCase());
        vehiculoUCC.getVehiculo().setNumMotor(txtMotor.getText().toUpperCase());
        vehiculoUCC.getVehiculo().setNumChasis(txtChasis.getText().toUpperCase());
        vehiculoUCC.getVehiculo().setPrecioCompra(Double.parseDouble(txtPrecio.getText()));
        vehiculoUCC.getVehiculo().setAnioFabricante(yearAñoFabricacion.getYear());
        vehiculoUCC.getVehiculo().setMatriculadoEn(cbxCiudad.getSelectedItem().toString());
        vehiculoUCC.getVehiculo().setFoto(f.getPath());
        vehiculoUCC.getVehiculo().setFecha(String.valueOf(dateFecha.getYear()));
        vehiculoUCC.getVehiculo().setClase(cbxClase.getSelectedItem().toString());
        vehiculoUCC.getVehiculo().setCilindraje(Double.parseDouble(txtCilindraje.getText()));
        if (edit == true) {
            vehiculoUCC.getVehiculo().setModificaciones(vehiculoUCC.getModificaciones());
        }
        vehiculoUCC.getVehiculo().setNombreMatricula(txtAnombre.getText().toUpperCase());
        vehiculoUCC.getVehiculo().setPrecioExtra(Double.parseDouble(txtPrecioVenta.getText()));

    }
}
